package com.zhoug.zmui3demo.ui;

import android.os.Bundle;
import android.widget.Button;
import android.widget.EditText;

import com.zhoug.zmui3.marquee.ZMUIMarqueeHorizontalTextView;
import com.zhoug.zmui3demo.R;

import androidx.appcompat.app.AppCompatActivity;

/**
 * @Author 35574
 * @Date 2021/7/30
 * @Description
 */
public class MarqueeActivity extends AppCompatActivity {

    private ZMUIMarqueeHorizontalTextView mZMUIMarqueeHorizontalTextView;
    private Button mBtnStart;
    private Button mBtnStop;
    private EditText mEtContent;
    private Button mBtnContent;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.marquee_activity);
        findViews();
        init();
        mZMUIMarqueeHorizontalTextView.setSpeed(3);
    }


    private void findViews() {
        mZMUIMarqueeHorizontalTextView = findViewById(R.id.ZMUIMarqueeHorizontalTextView);
        mBtnStart = findViewById(R.id.btnStart);
        mBtnStop = findViewById(R.id.btnStop);
        mEtContent = findViewById(R.id.et_content);
        mBtnContent = findViewById(R.id.btnContent);
    }

    private void init(){
        mBtnStart.setOnClickListener(v->{
            mZMUIMarqueeHorizontalTextView.start();
        });
        mBtnStop.setOnClickListener(v->{
            mZMUIMarqueeHorizontalTextView.stop();
        });
        mBtnContent.setOnClickListener(v->{
            mZMUIMarqueeHorizontalTextView.setText( mEtContent.getText().toString());

        });


    }


}
